from helper import *

import wx.html as html

class PrettyDisplayFrame(wx.MiniFrame):
	def __init__(self, parent, title, pos, size):
		wx.Frame.__init__(self, parent, -1, title, pos=pos, size=size, style=wx.NO_BORDER|wx.STAY_ON_TOP)#|wx.TRANSPARENT_WINDOW|wx.CLIP_CHILDREN)
		
		#-------------------------------------------------------------------------
		# Panel
		#-------------------------------------------------------------------------
		self.panel = html.HtmlWindow(self, style=wx.NO_BORDER, size=size)#|html.HW_SCROLLBAR_NEVER	)#|wx.TE_NO_VSCROLL) #, style=wx.TRANSPARENT_WINDOW|wx.CLIP_CHILDREN)
		#text_note = wx.StaticText(panel, -1, size=size)
		self.panel.Bind(html.EVT_HTML_LINK_CLICKED, self.OnClickLink)
		
		#self.text_note = text_note

		#-------------------------------------------------------------------------
		# Binding
		#-------------------------------------------------------------------------


		#-------------------------------------------------------------------------
		# Layout
		#-------------------------------------------------------------------------
		self.panel.Layout()
		self.pos = 0
		
	def OnClickLink(self, event):
		print event.GetLinkInfo().GetHref()
		
	def update_note(self, note):
		self.note = note
		self.panel.SetPage(note['html'])
		
	def set_note(self,note):
		self.note = note
	
	def set_colors(self, color_dict):
		self.panel.SetBackgroundColour(get_color('background'))
		#self.text_note.SetBackgroundColour(color_converter(color_dict['background']))
		#self.text_note.SetForegroundColour(color_converter(color_dict['foreground']))
		

	def next_page(self):
		return
		self.pos += 10
		self.panel.ScrollLines(10)
#		self.note_text.ShowPosition(self.note_text.GetInsertionPoint())


	def previous_page(self):
		return
		self.panel.ScrollPages(-1)
#		self.note_text.ShowPosition(self.note_text.GetInsertionPoint())